package com.kjj.gift.controller;

import com.kjj.gift.dto.PhoneRegisterDto;
import com.kjj.gift.dto.RegisterPhoneValidateDto;
import com.kjj.gift.dto.SMSCodeDto;
import com.kjj.gift.service.ISmsService;
import com.kjj.gift.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/sms")
public class SmsController {

    @Autowired
    private ISmsService smsService;
    @PostMapping("/sendCode")
    public AjaxResult sendSmsCode(@RequestBody  @Valid SMSCodeDto smsCodeDto){
            return smsService.sendSmsRegisterCode(smsCodeDto);
    }
    @PostMapping("/validate")
    AjaxResult validateRegisterCode(@RequestBody @Valid RegisterPhoneValidateDto dto){
        return smsService.validateRegisterCode(dto);
    }
}
